What output would you expect from the following C program?
#include <stdio.h>
int main(void) {
printf("%d\n",1<<2+3);
return 0;
}
So, to quickly evaluate it, 1<<2 must be 4, and 4 plus 3 is 7. So the output must be 7! No? No. Not quite. The "+" operator has a greater priority than the "<<" operator in C. Not quite what you would expect. So, evaluate it again: 2 plus 3 is 5, and 1<<5 is 32. And that's the correct result, after all.